package com.tian.core.utils;

import com.tian.core.exceptions.CheckException;

/**
 * 校验工具类
 *
 */
public class CheckUtil {


	public static void check(boolean condition, String msgKey) {
		if (!condition) {
			fail(msgKey);
		}
	}

	public static void notEmpty(String str, String msgKey) {
		if (str == null || str.isEmpty()) {
			fail(msgKey);
		}
	}

	public static void notNull(Object obj, String msgKey) {
		if (obj == null) {
			fail(msgKey);
		}
	}

	private static void fail(String msgKey) {
		throw new CheckException(msgKey);
	}
}
